package com.mos.iot.mqtt.config;

import com.mos.iot.mqtt.MqttClientManager;
import lombok.RequiredArgsConstructor;

import javax.annotation.PostConstruct;
import java.util.List;

@RequiredArgsConstructor
public class MqttConfig {

    private final MqttCustomerConfig customerConfig;

    @PostConstruct
    public void init() {
        List<MqttClientConfig> clientList = customerConfig.getClientList();
        if(clientList != null) {
            for (MqttClientConfig mqttClientConfig : clientList) {
                MqttClientManager.addMqttClient(mqttClientConfig);
            }
        }
    }

}
